#include "GameHandler.h"


int main(int argc, char* args[])
{
	// Fixed FPS count implementation
	unsigned int time_of_start, time_since_start; 

	const int fps   = 30; 
	const int delay = static_cast <int> (1000.0f / fps);

	if (GameHandler::Instance() -> Init("sdl2fwk tests", 100, 100, 800, 600, false))
	{
		while (GameHandler::Instance() -> isRunning())
		{
			time_of_start = SDL_GetTicks(); 

			GameHandler::Instance() -> handleEvents(); 
			GameHandler::Instance() -> Update(); 
			GameHandler::Instance() -> Render(); 

			time_since_start = SDL_GetTicks() - time_of_start; 

			if (time_since_start < delay)
			{
				SDL_Delay(static_cast <int> (delay - time_since_start)); 
			}
		}
	}

	else 
	{
		return -1; 
	}

	GameHandler::Instance() -> CleanUp(); 

	return 0;
}